<!doctype html><html lang dir=ltr><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>2.8 ~ 2.12 | 汇编语言 | Hui.Ke - Blog</title><meta name=generator content="Hugo Eureka 0.9.3"><link rel=stylesheet href=https://b.hui.ke/css/eureka.min.9cec6350e37e534b0338fa9a085bf06855de3b0f2dcf857e792e5e97b07ea905d4d5513db554cbc26a9c3da622bae92d.css><script defer src=https://b.hui.ke/js/eureka.min.fa9a6bf6d7a50bb635b4cca7d2ba5cf3dfb095ae3798773f1328f7950028b48c17d06276594e1b5f244a25a6c969a705.js></script>
<link rel=preconnect href=https://fonts.googleapis.com><link rel=preconnect href=https://fonts.gstatic.com crossorigin><link rel=preload href="https://fonts.googleapis.com/css2?family=Lora:wght@400;600;700&family=Noto+Serif+SC:wght@400;600;700&display=swap" as=style onload='this.onload=null,this.rel="stylesheet"'><link rel=stylesheet href=https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/styles/vs.min.css media=print onload='this.media="all",this.onload=null' crossorigin><script defer src=https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/highlight.min.js crossorigin></script>
<script defer src=https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/bash.min.js crossorigin></script>
<script defer src=https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/ini.min.js crossorigin></script>
<script defer src=https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/json.min.js crossorigin></script>
<script defer src=https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/php.min.js crossorigin></script>
<script defer src=https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/python.min.js crossorigin></script>
<script defer src=https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/shell.min.js crossorigin></script>
<script defer src=https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/sql.min.js crossorigin></script>
<script defer src=https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/x86asm.min.js crossorigin></script>
<script defer src=https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/xml.min.js crossorigin></script>
<link rel=stylesheet href=https://b.hui.ke/css/highlightjs.min.2958991528e43eb6fc9b8c4f2b8e052f79c4010718e1d1e888a777620e9ee63021c2c57ec7417a3108019bb8c41943e6.css media=print onload='this.media="all",this.onload=null'><script defer type=text/javascript src=https://lib.baomitu.com/font-awesome/6.1.1/js/all.min.js></script>
<link rel=stylesheet href=https://cdn.jsdelivr.net/npm/katex@0.15.2/dist/katex.min.css integrity=sha384-MlJdn/WNKDGXveldHDdyRP1R4CTHr3FeuDNfhsLPYrq2t0UBkUdK2jyTnXPEK1NQ media=print onload='this.media="all",this.onload=null' crossorigin><script defer src=https://cdn.jsdelivr.net/npm/katex@0.15.2/dist/katex.min.js integrity=sha384-VQ8d8WVFw0yHhCk5E8I86oOhv48xLpnDZx5T9GogA/Y84DcCKWXDmSDfn13bzFZY crossorigin></script>
<script defer src=https://cdn.jsdelivr.net/npm/katex@0.15.2/dist/contrib/auto-render.min.js integrity=sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR crossorigin></script>
<script>document.addEventListener("DOMContentLoaded",function(){renderMathInElement(document.body,{delimiters:[{left:"$$",right:"$$",display:!0},{left:"$",right:"$",display:!1},{left:"\\(",right:"\\)",display:!1},{left:"\\[",right:"\\]",display:!0}]})})</script><script defer src=https://cdn.jsdelivr.net/npm/mermaid@8.14.0/dist/mermaid.min.js integrity=sha384-atOyb0FxAgN9LyAc6PEf9BjgwLISyansgdH8/VXQH8p2o5vfrRgmGIJ2Sg22L0A0 crossorigin></script>
<link rel=icon type=image/png sizes=32x32 href=https://b.hui.ke/icon_hub7ca0b5404c6d576559b2bd22c64b0e5_2009_32x32_fill_box_center_3.png><link rel=apple-touch-icon sizes=180x180 href=https://b.hui.ke/icon_hub7ca0b5404c6d576559b2bd22c64b0e5_2009_180x180_fill_box_center_3.png><meta name=description content="  《汇编语言（第3版）》2.8 ~ 2.12、《零基础入门学习汇编语言》P9、10"><script type=application/ld+json>{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Docs","item":"https://b.hui.ke/docs/"},{"@type":"ListItem","position":2,"name":"汇编语言","item":"https://b.hui.ke/docs/assembly-language/"},{"@type":"ListItem","position":3,"name":"2.8 ~ 2.12","item":"https://b.hui.ke/docs/assembly-language/3/"}]}</script><script type=application/ld+json>{"@context":"https://schema.org","@type":"Article","mainEntityOfPage":{"@type":"WebPage","@id":"https://b.hui.ke/docs/assembly-language/3/"},"headline":"2.8 ~ 2.12 | 汇编语言 | Hui.Ke - Blog","datePublished":"2020-03-04T09:28:41+08:00","dateModified":"2020-03-04T09:28:41+08:00","wordCount":1861,"author":{"@type":"Person","name":"Hui.Ke"},"publisher":{"@type":"Person","name":"Hui.Ke","logo":{"@type":"ImageObject","url":"https://b.hui.ke/icon.png"}},"description":"\u003cp\u003e  《汇编语言（第3版）》2.8 ~ 2.12、《零基础入门学习汇编语言》P9、10\u003c\/p\u003e"}</script><meta property="og:title" content="2.8 ~ 2.12 | 汇编语言 | Hui.Ke - Blog"><meta property="og:type" content="article"><meta property="og:image" content="https://b.hui.ke/icon.png"><meta property="og:url" content="https://b.hui.ke/docs/assembly-language/3/"><meta property="og:description" content="  《汇编语言（第3版）》2.8 ~ 2.12、《零基础入门学习汇编语言》P9、10"><meta property="og:site_name" content="Hui.Ke - Blog"><meta property="article:published_time" content="2020-03-04T09:28:41+08:00"><meta property="article:modified_time" content="2020-03-04T09:28:41+08:00"><meta property="article:section" content="docs"><meta property="article:tag" content="CS"><meta property="article:tag" content="IP"><meta property="article:tag" content="传送指令"><meta property="og:see_also" content="https://b.hui.ke/docs/assembly-language/18/"><meta property="og:see_also" content="https://b.hui.ke/docs/assembly-language/17/"><meta property="og:see_also" content="https://b.hui.ke/docs/assembly-language/16/"><meta property="og:see_also" content="https://b.hui.ke/docs/assembly-language/15/"><meta property="og:see_also" content="https://b.hui.ke/docs/assembly-language/14/"><meta property="og:see_also" content="https://b.hui.ke/docs/assembly-language/13/"><meta property="og:see_also" content="https://b.hui.ke/docs/assembly-language/12/"><meta property="og:see_also" content="https://b.hui.ke/docs/assembly-language/11/"><meta property="og:see_also" content="https://b.hui.ke/docs/assembly-language/10/"><meta property="og:see_also" content="https://b.hui.ke/docs/assembly-language/9/"><meta property="og:see_also" content="https://b.hui.ke/docs/assembly-language/8/"><meta property="og:see_also" content="https://b.hui.ke/docs/assembly-language/7/"><meta property="og:see_also" content="https://b.hui.ke/docs/assembly-language/6/"><meta property="og:see_also" content="https://b.hui.ke/docs/assembly-language/5/"><meta property="og:see_also" content="https://b.hui.ke/docs/assembly-language/4/"><meta property="og:see_also" content="https://b.hui.ke/docs/assembly-language/2/"><meta property="og:see_also" content="https://b.hui.ke/docs/assembly-language/1/"><script>!function(e){"use strict";!function(){var i,s=window,o=document,a=e,c="".concat("https:"===o.location.protocol?"https://":"http://","sdk.51.la/js-sdk-pro.min.js"),n=o.createElement("script"),r=o.getElementsByTagName("script")[0];n.type="text/javascript",n.setAttribute("charset","UTF-8"),n.async=!0,n.src=c,n.id="LA_COLLECT",a.d=n,i=function(){s.LA.ids.push(a)},s.LA?s.LA.ids&&i():(s.LA=e,s.LA.ids=[],i()),r.parentNode.insertBefore(n,r)}()}({id:"Jgb8aUbG5e3rqhrs",ck:"Jgb8aUbG5e3rqhrs",autoTrack:!0,hashMode:!0})</script><body class="flex min-h-screen flex-col"><header class="min-h-16 pl-scrollbar bg-secondary-bg fixed z-50 flex w-full items-center shadow-sm"><div class="mx-auto w-full max-w-screen-xl"><script>let storageColorScheme=localStorage.getItem("lightDarkMode");((storageColorScheme=="Auto"||storageColorScheme==null)&&window.matchMedia("(prefers-color-scheme: dark)").matches||storageColorScheme=="Dark")&&document.getElementsByTagName("html")[0].classList.add("dark")</script><nav class="flex items-center justify-between flex-wrap px-4 py-4 md:py-0"><a href=/ class="me-6 text-primary-text text-xl font-bold">Hui.Ke - Blog</a>
<button id=navbar-btn class="md:hidden flex items-center px-3 py-2" aria-label="Open Navbar">
<i class="fas fa-bars"></i></button><div id=target class="hidden block md:flex md:grow md:justify-between md:items-center w-full md:w-auto text-primary-text z-20"><div class="md:flex md:h-16 text-sm md:grow pb-4 md:pb-0 border-b md:border-b-0"><a href=/posts/ class="block mt-4 md:inline-block md:mt-0 md:h-(16-4px) md:leading-(16-4px) box-border md:border-t-2 md:border-b-2 border-transparent me-4">Posts</a>
<a href=/docs/ class="block mt-4 md:inline-block md:mt-0 md:h-(16-4px) md:leading-(16-4px) box-border md:border-t-2 md:border-b-2 selected-menu-item me-4">Docs</a>
<a href=/categories/ class="block mt-4 md:inline-block md:mt-0 md:h-(16-4px) md:leading-(16-4px) box-border md:border-t-2 md:border-b-2 border-transparent me-4">Categories</a>
<a href=/series/ class="block mt-4 md:inline-block md:mt-0 md:h-(16-4px) md:leading-(16-4px) box-border md:border-t-2 md:border-b-2 border-transparent me-4">Series</a>
<a href=/tags/ class="block mt-4 md:inline-block md:mt-0 md:h-(16-4px) md:leading-(16-4px) box-border md:border-t-2 md:border-b-2 border-transparent me-4">Tags</a>
<a href=/love/ class="block mt-4 md:inline-block md:mt-0 md:h-(16-4px) md:leading-(16-4px) box-border md:border-t-2 md:border-b-2 border-transparent me-4">Love</a>
<a href=/about/ class="block mt-4 md:inline-block md:mt-0 md:h-(16-4px) md:leading-(16-4px) box-border md:border-t-2 md:border-b-2 border-transparent me-4">About</a></div><div class=flex><div class="relative pt-4 md:pt-0"><div class="cursor-pointer hover:text-eureka" id=lightDarkMode><i class="fas fa-adjust"></i></div><div class="fixed hidden inset-0 opacity-0 h-full w-full cursor-default z-30" id=is-open></div><div class="absolute flex flex-col start-0 md:start-auto end-auto md:end-0 hidden bg-secondary-bg w-48 rounded py-2 border border-tertiary-bg cursor-pointer z-40" id=lightDarkOptions><span class="px-4 py-1 hover:text-eureka" name=Light>Light</span>
<span class="px-4 py-1 hover:text-eureka" name=Dark>Dark</span>
<span class="px-4 py-1 hover:text-eureka" name=Auto>Auto</span></div></div></div></div><div class="fixed hidden inset-0 opacity-0 h-full w-full cursor-default z-0" id=is-open-mobile></div></nav><script>let element=document.getElementById("lightDarkMode");storageColorScheme==null||storageColorScheme=="Auto"?document.addEventListener("DOMContentLoaded",()=>{window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",switchDarkMode)}):storageColorScheme=="Light"?(element.firstElementChild.classList.remove("fa-adjust"),element.firstElementChild.setAttribute("data-icon","sun"),element.firstElementChild.classList.add("fa-sun")):storageColorScheme=="Dark"&&(element.firstElementChild.classList.remove("fa-adjust"),element.firstElementChild.setAttribute("data-icon","moon"),element.firstElementChild.classList.add("fa-moon")),document.addEventListener("DOMContentLoaded",()=>{getcolorscheme(),switchBurger()})</script></div></header><main class="grow pt-16"><div class=pl-scrollbar><div class="mx-auto w-full max-w-screen-xl lg:px-4 xl:px-8"><div class=lg:pt-12><div class="flex flex-col md:flex-row bg-secondary-bg rounded"><div class="md:w-1/4 lg:w-1/5 border-e"><div class="sticky top-16 pt-6"><div id=sidebar-title class="md:hidden mx-4 px-2 pt-4 pb-2 md:border-b text-tertiary-text md:text-primary-text"><span class=font-semibold>Table of Contents</span>
<i class='fas fa-caret-right ms-1'></i></div><div id=sidebar-toc class="hidden md:block overflow-y-auto mx-6 md:mx-0 pe-6 pt-2 md:max-h-doc-sidebar bg-primary-bg md:bg-transparent"><div class="flex flex-wrap ms-4 -me-2 p-2 bg-secondary-bg md:bg-primary-bg rounded"><a class=hover:text-eureka href=https://b.hui.ke/docs/assembly-language/>汇编语言</a></div><ul class=ps-6><li class=py-2><div><a class=hover:text-eureka href=https://b.hui.ke/docs/assembly-language/18/>11.9 ~ 11.11</a></div></li><li class=py-2><div><a class=hover:text-eureka href=https://b.hui.ke/docs/assembly-language/17/>11.7 ~ 11.9</a></div></li><li class=py-2><div><a class=hover:text-eureka href=https://b.hui.ke/docs/assembly-language/16/>11.1 ~ 11.6</a></div></li><li class=py-2><div><a class=hover:text-eureka href=https://b.hui.ke/docs/assembly-language/15/>10.8 ~ 10.12</a></div></li><li class=py-2><div><a class=hover:text-eureka href=https://b.hui.ke/docs/assembly-language/14/>10.1 ~ 10.7</a></div></li><li class=py-2><div><a class=hover:text-eureka href=https://b.hui.ke/docs/assembly-language/13/>9.7 ~ 9.9</a></div></li><li class=py-2><div><a class=hover:text-eureka href=https://b.hui.ke/docs/assembly-language/12/>9.1 ~ 9.6</a></div></li><li class=py-2><div><a class=hover:text-eureka href=https://b.hui.ke/docs/assembly-language/11/>8.5 ~ 8.9</a></div></li><li class=py-2><div><a class=hover:text-eureka href=https://b.hui.ke/docs/assembly-language/10/>8.1</a></div></li><li class=py-2><div><a class=hover:text-eureka href=https://b.hui.ke/docs/assembly-language/9/>7.1 ~ 7.10</a></div></li><li class=py-2><div><a class=hover:text-eureka href=https://b.hui.ke/docs/assembly-language/8/>6.1 ~ 6.3</a></div></li><li class=py-2><div><a class=hover:text-eureka href=https://b.hui.ke/docs/assembly-language/7/>5.1 ~ 5.4</a></div></li><li class=py-2><div><a class=hover:text-eureka href=https://b.hui.ke/docs/assembly-language/6/>4.1 ~ 4.9</a></div></li><li class=py-2><div><a class=hover:text-eureka href=https://b.hui.ke/docs/assembly-language/5/>3.6 ~ 3.10</a></div></li><li class=py-2><div><a class=hover:text-eureka href=https://b.hui.ke/docs/assembly-language/4/>3.1 ~ 3.5</a></div></li><li class=py-2><div><a class="text-eureka hover:text-eureka" href=https://b.hui.ke/docs/assembly-language/3/>2.8 ~ 2.12</a></div></li><li class=py-2><div><a class=hover:text-eureka href=https://b.hui.ke/docs/assembly-language/2/>1.11 ~ 2.6</a></div></li><li class=py-2><div><a class=hover:text-eureka href=https://b.hui.ke/docs/assembly-language/1/>1.1 ~ 1.10</a></div></li></ul></div></div></div><div class="w-full md:w-3/4 lg:w-4/5 pb-8 pt-2 md:pt-8"><div class=flex><div class="w-full lg:w-3/4 px-6"><article class=prose><h1 class=mb-4>2.8 ~ 2.12</h1><div class="text-tertiary-text not-prose mt-2 flex flex-row flex-wrap items-center"><div class="me-6 my-2"><i class="fas fa-calendar me-1"></i>
<span>2020-03-04</span></div><div class="me-6 my-2"><i class="fa-solid fa-pen-to-square me-1"></i>
<span>2020-03-04</span></div><div class="me-6 my-2"><i class="fas fa-clock me-1"></i>
<span>4 min read</span></div><div class="me-6 my-2"><i class="fas fa-folder me-1"></i>
<a href=https://b.hui.ke/categories/it/ class=hover:text-eureka>IT</a></div><div class="me-6 my-2"><i class="fas fa-th-list me-1"></i>
<a href=https://b.hui.ke/series/x86asm-language/ class=hover:text-eureka>x86asm Language</a></div><div class="me-6 my-2"><i class="fa-solid fa-eye me-1"></i>
<span id=busuanzi_value_page_pv><i class="fa fa-spinner fa-spin"></i></span> Hits</div></div><p>  《汇编语言（第3版）》2.8 ~ 2.12、《零基础入门学习汇编语言》P9、10</p><h3 id=28-段的概念>2.8 段的概念</h3><p>  错误认识：<del>内存被划分成了一个一个的段，每一个段有一个段地址。</del></p><p>  其实：内存并没有分段，段的划分来自于 CPU，由于 8086 CPU 用“（段地址×16）+ 偏移地址 = 物理地址”的方式给出内存单元的物理地址，使得我们可以用分段的方式来管理内存。</p><p>  段地址×16 必然是 16 的倍数，所以一个段的起始地址也一定是 16 的倍数；</p><p>  偏移地址为 16 位，16 位地址的寻址能力为 64K，所以一个段的长度最大为 64K。</p><p>  CPU 访问内存单元时，必须向内存提供内存单元的物理地址。</p><p>  8086 CPU 在内部用段地址和偏移地址移位相加的方法形成最终的物理地址。</p><table><thead><tr><th style=text-align:center>物理地址</th><th style=text-align:center>段地址</th><th style=text-align:center>偏移地址</th></tr></thead><tbody><tr><td style=text-align:center>21F60H</td><td style=text-align:center>2000H</td><td style=text-align:center>1F60H</td></tr><tr><td style=text-align:center>2100H</td><td style=text-align:center>0F60H</td><td></td></tr><tr><td style=text-align:center>21F0H</td><td style=text-align:center>0F60H</td><td></td></tr><tr><td style=text-align:center>21F6H</td><td style=text-align:center>0000H</td><td></td></tr><tr><td style=text-align:center>1F00H</td><td style=text-align:center>2F60H</td><td></td></tr></tbody></table><p>  上表可得：CPU 可以用不同的段地址和偏移地址形成同一个物理地址。</p><p>  给定一个段地址，仅通过变化偏移地址来进行寻址，最多可以定位 64K 个内存单元（偏移地址 16 位，变化范围为 0 ~ FFFFH），比如：给定段地址 1000H，用偏移地址寻址，CPU 的寻址范围为：10000H ~ 1FFFFH。</p><h3 id=28-小结>2.8 小结</h3><ol><li>在 8086 PC 机中，存储单元的地址用两个元素来描述。即段地址和偏移地址。</li><li>“数据在 21F60H 内存单元中。”对于 8086 PC 机的两种描述<ol><li>数据存在内存 2000:1F60 单元中；</li><li>数据存在内存的 2000 段中的 1F60H 单元中。</li></ol></li><li>可根据需要，将地址连续、起始地址为 16 的倍数的一组内存单元定义为一个段。</li></ol><h3 id=29-段寄存器>2.9 段寄存器</h3><p>  段寄存器就是提供段地址的。</p><p>  8086 CPU 有 4 个段寄存器</p><ol><li>CS（Code Segment）代码段寄存器</li><li>DS（Data Segment）数据段寄存器</li><li>SS（Stack Segment）堆栈段寄存器</li><li>ES（Extra Segment）附加段寄存器</li></ol><p>  当 8086 CPU 要访问内存时，由这 4 个段寄存器提供内存单元的段地址。</p><h3 id=210-cs-和-ip>2.10 CS 和 IP</h3><p>  CS 和 IP 是 8086 CPU 中最关键的寄存器，它们指示了 CPU 当前要读取指令的地址。</p><p>  CS 为代码段寄存器，IP 为指令指针寄存器。</p><p>  8086 PC 工作过程的简要描述</p><p>  工作流程</p><ol><li>从 CS:IP 指向内存单元读取指令，读取的指令进入指令缓冲器；</li><li>IP = IP + 所读取指令的长度，从而指向下一条指令；</li><li>执行指令。转到步骤 1，重复这个过程。</li></ol><p>  在 8086 CPU 加电启动或复位后（即 CPU 刚开始工作时）CS 和 IP 被设置为 CS=FFFFH，IP=0000H。即在 8086 PC 机刚启动时，CPU 从内存 FFFF0H 单元中读取指令执行。FFFF0H 单元中的指令是 8086 PC 机开启后执行的第一条指令。</p><p>  在任何时候，CPU 将 CS、IP 中的内容当作指令的段地址和偏移地址，用它们合成指令的物理地址，到内存中读取指令码，执行。</p><p>  如果说，内存中的一段信息曾被 CPU 执行过的话，那么，它所在的内存单元必然被 CS:IP 指向过。</p><p>  在 CPU 中，程序员能够用指令读写的部件只有寄存器，程序员可以通过改变寄存器中的内容实现对 CPU 的控制。</p><p>  CPU 从何处执行指令是由 CS、IP 中的内容决定的，程序员可以通过改变 CS、IP 中的内容来控制 CPU 执行目标指令。</p><h3 id=211-修改-csip-的指令>2.11 修改 CS、IP 的指令</h3><p>  如：mov ax,123，mov 指令可以改变 8086 CPU 大部分寄存器的值，被称为传送指令。</p><blockquote><p>mov 指令（传送指令）不能用于设置 CS、IP 的值</p></blockquote><p>  同时修改 CS、IP 的内容：jmp 段地址:偏移地址，功能：用指令中给出的段地址修改 CS，偏移地址修改 IP。</p><table><thead><tr><th style=text-align:left>转移指令</th><th style=text-align:left>物理地址</th></tr></thead><tbody><tr><td style=text-align:left>jmp 2AE3:3</td><td style=text-align:left>2AE33H</td></tr><tr><td style=text-align:left>jmp 3:0B16</td><td style=text-align:left>00B46H（=0003×10+0B16）</td></tr></tbody></table><p>  仅修改 IP 的内容：jmp 某一合法寄存器，如：jmp ax（<strong>类似于</strong> mov IP,ax），功能：用寄存器中的值修改 IP。</p><h3 id=212-代码段>2.12 代码段</h3><p>  对于 8086 PC 机，在编程时，可以根据需要，将一组内存单元定义为一个段。</p><p>  可以将长度为 N（N≤64KB）的一组代码，存在一组地址连续、起始地址为 16 的倍数的内存单元中，这段内存是用来存放代码的，从而定义了一个代码段。</p><p>  将一段内存当作代码段，仅仅是我们在编程时的一种安排，CPU 并不会由于这种安排，就自动地将我们定义的代码段中的指令当作指令来执行。</p><blockquote><p>CPU 只认被 CS:IP 指向的内存单元中的内容为指令。</p></blockquote><p>  所以要将 CS:IP 指向所定义的代码段中的第一条指令的首地址。</p><h3 id=212-小结>2.12 小结</h3><ol><li>段地址在 8086 CPU 的寄存器中存放。当 8086 CPU 要访问内存时，由段寄存器提供内存单元的段地址。8086 CPU 有 4 个段寄存器，其中 CS 用来存放指令的段地址。</li><li>CS 存放指令的段地址，IP 存放指令的偏移地址。</li><li>8086 机中，任意时刻，CPU 将 CS:IP 指向的内容当作指令执行。</li><li>8086 CPU 的工作过程<ol><li>从 CS:IP 指向内存单元读取指令，读取的指令进入指令缓冲器；</li><li>IP 指向下一条指令；</li><li>执行指令。（转到步骤 1，重复这个过程。）</li></ol></li><li>8086 CPU 提供转移指令修改 CS、IP 的内容。</li></ol><h3 id=debug>DEBUG</h3><p>  R 命令查看、改变 CPU 寄存器的内容；</p><p>  D 命令查看内存中的内容；</p><p>  E 命令改写内存中的内容；</p><p>  U 命令将内存中的机器指令翻译成汇编指令；</p><p>  T 命令执行一条机器指令；</p><p>  A 命令以汇编指令的格式在内存中写入一条机器指令。</p></article><div class=my-4><a href=https://b.hui.ke/tags/cs/ class="inline-block bg-tertiary-bg text-sm rounded px-3 py-1 my-1 me-2 hover:text-eureka">#CS</a>
<a href=https://b.hui.ke/tags/ip/ class="inline-block bg-tertiary-bg text-sm rounded px-3 py-1 my-1 me-2 hover:text-eureka">#IP</a>
<a href=https://b.hui.ke/tags/%E4%BC%A0%E9%80%81%E6%8C%87%E4%BB%A4/ class="inline-block bg-tertiary-bg text-sm rounded px-3 py-1 my-1 me-2 hover:text-eureka">#传送指令</a></div><div class=py-2><div class="my-8 flex flex-col items-center md:flex-row"><a href=https://b.hui.ke/authors/hui.ke/ class="md:me-4 text-primary-text h-24 w-24"><img src=https://b.hui.ke/bagua.webp class="bg-primary-bg w-full rounded-full" alt=Avatar></a><div class="mt-4 w-full md:mt-0 md:w-auto"><a href=https://b.hui.ke/authors/hui.ke/ class="mb-2 block border-b pb-1 text-lg font-bold"><h3>Hui.Ke</h3></a><span class="block pb-2">❤ Cyber Security | Safety is a priority.</span>
<a href=mailto:3199731997@qq.com class=me-2><i class="fas fa-envelope"></i></a>
<a href="https://wpa.qq.com/msgrd?v=3&uin=3199731997" class=me-2><i class="fab fa-qq"></i></a>
<a href=/images/aixinxianquan.webp class=me-2><i class="fab fa-weixin"></i></a></div></div></div><div class="-mx-2 mt-4 flex flex-col border-t px-2 pt-4 md:flex-row md:justify-between"><div><span class="text-primary-text block font-bold">Previous</span>
<a href=https://b.hui.ke/docs/assembly-language/4/ class=block>3.1 ~ 3.5</a></div><div class="mt-4 md:mt-0 md:text-right"><span class="text-primary-text block font-bold">Next</span>
<a href=https://b.hui.ke/docs/assembly-language/2/ class=block>1.11 ~ 2.6</a></div></div><div id=valine-comments class=mt-4></div><script defer src=https://cdn.jsdelivr.net/npm/valine@1.4.16/dist/Valine.min.js integrity=sha384-e0+DNUCJo75aOAzHQbFWYBCM9/S4f0BhRJXvEgbE3mMS85RM20MSSGStHuNdY2QK crossorigin></script>
<script>document.addEventListener("DOMContentLoaded",function(){new Valine({el:"#valine-comments",appId:"BQnVqWIiq78AdqwyhvBVAa3y-MdYXbMMI",appKey:"RKg5By312YjM8rU6WkkfK9IN",recordIP:"true",serverURLs:"https://l.hui.ke",visitor:"true"})})</script></div><div class="hidden lg:block lg:w-1/4"><div class="bg-secondary-bg
prose sticky top-16 z-10 hidden px-6 py-4 lg:block"><h3>On This Page</h3></div><div class="sticky-toc
border-s
hidden px-6 pb-6 lg:block"><nav id=TableOfContents><ul><li><ul><li><a href=#28-段的概念>2.8 段的概念</a></li><li><a href=#28-小结>2.8 小结</a></li><li><a href=#29-段寄存器>2.9 段寄存器</a></li><li><a href=#210-cs-和-ip>2.10 CS 和 IP</a></li><li><a href=#211-修改-csip-的指令>2.11 修改 CS、IP 的指令</a></li><li><a href=#212-代码段>2.12 代码段</a></li><li><a href=#212-小结>2.12 小结</a></li><li><a href=#debug>DEBUG</a></li></ul></li></ul></nav></div><script>window.addEventListener("DOMContentLoaded",()=>{enableStickyToc()})</script></div></div></div></div></div><script>document.addEventListener("DOMContentLoaded",()=>{hljs.highlightAll(),changeSidebarHeight(),switchDocToc()})</script></div></div></main><footer class=pl-scrollbar><div class="mx-auto w-full max-w-screen-xl"><div class="text-center p-6 pin-b"><script async src=/js/click.js></script><div id=poem_ip></div><script type=text/javascript>jinrishici.load(function(e){tags.innerHTML=e.data.matchTags})</script><div><span id=timeDate>载入年天数...</span><span id=times>载入时分秒...</span>
<script async src=/js/duration.js></script></div><a href=https://www.foreverblog.cn/go.html target=_blank><img src=https://img.foreverblog.cn/wormhole_4_tp.gif alt style=display:inline-block;width:auto;height:32px title=穿梭虫洞-随机访问十年之约友链博客></a><p class="text-sm text-tertiary-text"><script async src=//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js></script>本站总访问量 <span id=busuanzi_value_site_pv></span> 次
&#183; 您是本站的第 <span id=busuanzi_value_site_uv></span> 个小伙伴</p><script async src=/js/tab.js></script></div></div></footer></body></html>